extends RigidBody2D

func _ready() -> void:
	body_entered.connect(_on_CharacterBody2D_collision)

func _on_CharacterBody2D_collision(body: Node2D) -> void:
	if body == Global.player:  # 确保碰撞对象是角色
		var direction = (body.position - position).normalized()
		# 将角色的推动力作用到小球上
		apply_impulse(Vector2.ZERO, direction * body.velocity.length() * body.push_strength)
